{include file="public/header" /}
<style type="text/css">
    .gray-bg {
        background: #fff;
    }

    .wrapper {
        padding: 0;
    }

    .image-item {
        margin-bottom: 20px;
        height: 284px;
        overflow: hidden;
    }

    .image-item div {
        width: 100%;
        overflow: hidden;
    }

    .image-item .img-top {
        height: 145px;
    }

    .image-item .img-bottom {
        margin-top: 8px;
        height: 43px;
    }

    .image-item .img-bottom select {
        width: 50%;
    }

    .image-item div img {
        width: 100%;
    }

    .image-item button {
        position: absolute;
        right: 15px;
        display: block;
    }

    #images-item {
        margin-left: 100px;
        margin-right: 100px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <form class="form-horizontal" method="post">
            <input name="member_id" type="hidden" value="{:input('get.id/d')}"/>
            <div class="col-sm-12">
                <div class="ibox-content">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">类型：</label>
                        <div class="col-sm-9">
                            <div class="radio i-checks">
                                <label>
                                    <input class="burn" type="radio" value="1" name="type" checked>正常照片
                                </label>
                                <label>
                                    <input class="burn" type="radio" value="2" name="type">阅后即焚
                                </label>
                                <label>
                                    <input class="burn" type="radio" value="3" name="type">红包照片
                                </label>

                            </div>
                        </div>
                    </div>

                    <div class="form-group packet" style="display: none;">
                        <label class="col-sm-2 control-label">红包金额：</label>
                        <div class="col-sm-9">
                            <input name="red_packet_price" type="text" class="form-control" value="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">图片集：</label>
                        <div class="col-sm-9">
                            <div id="demo"></div>
                        </div>
                    </div>
                    <input type="hidden" name="image_ids" value=""/>
                    <div class="form-group" id="images-item">

                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="public/footer" /}
<!-- 引用控制层插件样式 -->
{load href="__STYLE__/admin/plugins/zyUpload/zyUpload.css"}
<!-- 引用核心层插件 -->
{load href="__STYLE__/admin/plugins/zyUpload/zyUpload.js"}
<script type="text/javascript" src="__STYLE__/admin/plugins/zyUpload/script.js?ver=20200527"></script>
{load href="__STYLE__/admin/plugins/iCheck/icheck.min.js"}
{load href="__STYLE__/admin/plugins/iCheck/custom.css"}



<script type="text/javascript">
    $(document).ready(function () {
        $(".i-checks").iCheck({
            checkboxClass: "icheckbox_square-green",
            radioClass: "iradio_square-green",
        });
        $('input[name=type]').on('ifChecked', function(obj){
            var burn = $(this).val();
            if (burn == 3) {
                $('.packet').show();
            } else {
                $('.packet').hide();
            }
        })
    });

    var urlupload = "{:url('file/uploadImages', ['path' => 'ablbum/admin', 'fileType' => 999])}";
    function callback(res) {
        var html = '<div class="col-md-3 col-sm-4 col-xs-6 image-item" id="file' + res.id + '">';
        html += '<button type="button" class="btn btn btn-sm btn-danger" onclick="delImg(' + res.id + ')"><i class="fa fa-trash"></i> 删除</button>';
        html += '<div class="img-top"><img src="' + res.img + '" /></div>';
        html += '<div class="img-bottom">';
        html += '<label class="col-sm-6 control-label">图片状态：</label>';
        html += '<select class="form-control" name="file[' + res.id + '][status]">';
        html += '<option value="1">正常</option><option value="2">违规</option>';
        html += '</select>';
        html += '</div>';
        html += '<textarea style="resize:none;" class="form-control" name="file[' + res.id + '][remark]" rows="3"></textarea>';
        html += '</div>';
        $("#images-item").append(html);
        var image_ids = $("input[name='image_ids']").val();
        if (image_ids.length > 0) image_ids += ',';
        image_ids += res.id;
        $("input[name='image_ids']").val(image_ids);
    }

    function delImg(id) {
        layer.confirm('是否删除该照片', {
            btn: ['确定', '取消']
        }, function (index) {
            layer.close(index);
            $("#images-item").find('#file' + id).remove();
        });
    }

    $("#choose").change(function () {
        var choose_val = $(this).val();
        $(".date_time").hide();
        $("#date_time_" + choose_val).show();
    });

</script>

{include file="public/bottom" /}